import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import * as echarts from "echarts";
import ElementUI from "element-ui";
import GlobalComponent from "./components/index";
import Api from "./api/index.js";
import * as Columns from "./assets/js/columns.js";
import Directive from "@/directive/index.js"; // 自定义指令

import quinn from "./utils/quinn";
import "element-ui/lib/theme-chalk/index.css";
import "./assets/css/index.less";
import { API_HOST, IMG_HOST, $acc } from "@/assets/js/define.js";
import '@/store/preventReClick'
import dataV from '@jiaminghi/data-view'

Vue.use(dataV);
 

Vue.use(Api);
Vue.use(Directive);
Vue.use(ElementUI);
Vue.use(GlobalComponent);
Vue.prototype.$echarts = echarts;
Vue.prototype.$columns = Columns;
Vue.prototype.$quinn = quinn;
Vue.prototype.$acc = $acc;
Vue.prototype.$apiHost = API_HOST;
Vue.prototype.$imgHost = IMG_HOST;
window.$quinn = Vue.prototype.$quinn;

window.vue = new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
Vue.directive('removeAriaHidden', {
  bind(el, binding) {
    let ariaEls = el.querySelectorAll('.el-radio__original');
    ariaEls.forEach((item) => {
      item.removeAttribute('aria-hidden');
    });
  }
});
Vue.directive('number-only', {
  bind(el) {
    el.addEventListener('keypress', (e) => {
      const charCode = e.which ? e.which : e.keyCode;
        if (charCode > 31 && (charCode < 48 || charCode > 57)&&charCode!=46) {
        e.preventDefault();
      }
    });
    el.addEventListener('input', (e) => {
      e.target.value = e.target.value.replace(/[^\d.]/g, '');
    });
  }
});
